/// <reference path="../App.ts" />
/// <reference path="../../../Definitions/_3rd_part/jquery.d.ts" />
/// <reference path="../../../Definitions/_prod/Office.d.ts" />
(function () {
    "use strict";

    // ReSharper disable once InconsistentNaming
    var Office = Microsoft.Office.WebExtension;
    var app = new App();

    // The Office initialize function must be run each time a new page is loaded
    Office.initialize = function (reason) {
        $(document).ready(function () {
            app.initialize();

            displayItemDetails();
        });
    };

    // Displays the "Subject" and "From" fields, based on the current mail item
    function displayItemDetails() {
        var item = Office.context.mailbox.item;
        var from;

        if (item.itemType === Office.MailboxEnums.ItemType.Message) {
            from = (item).from;
            $('#subject').text((item).subject);
        } else if (item.itemType === Office.MailboxEnums.ItemType.Appointment) {
            from = (item).organizer;
            $('#subject').text((item).subject);
        }

        if (from) {
            $('#from').text(from.displayName);
            $('#from').click(function () {
                app.showNotification(from.displayName, from.emailAddress);
            });
        }
    }
})();
//# sourceMappingURL=Home.js.map
